package net.qhzw.vip.qiyu.controller;


import io.swagger.annotations.Api;
import net.qhzw.vip.qiyu.entity.Area;
import net.qhzw.vip.qiyu.entity.LogisticsArea;
import net.qhzw.vip.qiyu.result.JsonResult;
import net.qhzw.vip.qiyu.service.LogisticsAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 货运部地区数据权限
 */

@RestController
@RequestMapping("/logisticsArea")
@Api(tags = "货运部地区数据权限接口")
public class LogisticsAreaController {

    @Autowired
    private LogisticsAreaService logisticsAreaService;

    /**
     * 分配地区数据
     * @param logisticsArea
     * @return
     */
    @PostMapping("/allocationOfRegions")
    public JsonResult allocationOfRegions(@RequestBody LogisticsArea logisticsArea) {
        logisticsAreaService.allocationOfRegions(logisticsArea);
        return JsonResult.ok();
    }


    /**
     * 查询该商户的地区列表
     * @return
     */
    @GetMapping("merchantsRgnLst/{shopId}")
    public JsonResult<Area> merchantsRgnLst(@PathVariable Long shopId){
        Area area = logisticsAreaService.merchantsRgnLst(shopId);
        return JsonResult.ok(area);
    }


}
